﻿//Created by Action Script Viewer - http://www.buraks.com/asv
package Init.PostInit.PostInitActions {
    import Events.*;
    import Display.DialogUI.*;
    import Classes.*;
    import Transactions.*;
    import Classes.util.*;
    import ZLocalization.*;
    import Display.*;

    public class StartupVisitActionDialog extends StartupMessage {

        public static const DEFAULT_ICON_ASSET_URL:String = "assets/dialogs/feeds/feed_vacantlot.png";

        protected var m_neighborId:String = "";

        public function StartupVisitActionDialog(_arg1:String, _arg2:Boolean, _arg3:Object, _arg4:String="assets/dialogs/feeds/feed_vacantlot.png", _arg5:String="StartUpDialogA", _arg6:String="StartUpDialogA_text", _arg7:String="StartUpDialogB_text", _arg8:String="StartUpDialogC_text", _arg9:String="StartUpDialogD_text", _arg10:Boolean=true){
            var _local15:Boolean;
            this.m_neighborId = _arg1;
            var _local11:String = _arg6;
            var _local12:int = GenericPopup.TYPE_OK;
            var _local13:Function;
            if (_arg2){
            } else {
                if (Global.guide.isActive()){
                    _local11 = _arg7;
                    _local13 = this.onSetHudNonDefault;
                } else {
                    _local15 = Global.player.isFriendANeighbor(this.m_neighborId);
                    if (_local15){
                        _local11 = _arg8;
                        _local12 = GenericDialogView.TYPE_VISIT;
                        _local13 = this.onVisitNeighbor;
                    } else {
                        _local11 = _arg9;
                        _local12 = GenericDialogView.TYPE_ADDNEIGHBOR;
                        _local13 = this.onInviteNeighbor;
                    };
                };
            };
            _arg3.friendName = this.getFriendName();
            var _local14:String = ZLoc.t("Dialogs", _local11, _arg3);
            super(_arg5, _local14, _local11, _local13, _arg4, _local12, _arg10);
        }
        public function onSetHudNonDefault(_arg1:GenericPopupEvent):void{
            StartUpDialogManager.returnToDefaultHUD = false;
        }
        public function onVisitNeighbor(_arg1:GenericPopupEvent):void{
            if (_arg1.button == GenericPopup.YES){
                StartUpDialogManager.returnToDefaultHUD = false;
                StartUpDialogManager.clearDialogQueue();
                if (this.m_neighborId != "0"){
                    GameTransactionManager.addTransaction(new TGetVisitMission(this.m_neighborId), true);
                };
            };
        }
        public function onInviteNeighbor(_arg1:GenericPopupEvent):void{
            if (_arg1.button == GenericPopup.YES){
                FrameManager.showTray("invite.php?ref=startup_dialog");
            };
        }
        private function getFriendName():LocalizationName{
            var _local1 = "";
            var _local2:Player = Global.player.findFriendById(this.m_neighborId);
            if (_local2){
                _local1 = _local2.firstName;
            };
            return (ZLoc.tn(_local1));
        }

    }
}//package Init.PostInit.PostInitActions 
